<template>
	<view class="form-container">
		<view class="form-box">
			<block v-for="(item,index) in formDate" :key="item.rules.name">
				<!-- 单行文本框 -->
				<!-- 隐藏控件item.property.fishidden==0 -->
				<view class="line" v-show="item.property.fishidden==0"
					:style="[item.property.fishidden==0 ?'display:flex;' : 'display:none;',bj]"
					v-if="item.type=='text' || item.type=='number' || item.type=='password'">
					<view :class="item.rules.verify.indexOf('req')!=-1 ? 'line-left' :'p-l14 line-left' "><text
							:class="!item.disabled ?'colorRed1' :'colorRed2'"><text class='colorRed'
								v-if="item.rules.verify.indexOf('req')!=-1">*</text>{{item.label+":"}}</text></view>
					<!-- 这里是扫码按钮                      auto-blur收起键盘，不去除光标-->
					<view class="line-right send-code-box" v-if="item.rules.flag=='6'">
						<input :type="item.type" :disabled="item.disabled" confirm-type="search"
							@confirm="enter(index,item.property,$event)" :adjust-position="false"
							:maxlength="item.maxlength" class="input"
							@keyup.enter="enter(index,item.property,item.rules.value)" :focus="item.firstFocus"
							:auto-blur="false" @focus="focus(index,item.property,item.rules.value)"
							@blur="blur(index,item.property,item.rules.value)" placeholder-class="plaClass"
							:placeholder='item.placeholder' v-model="item.rules.value" @input="inputVal(index)"></input>
						<Am-FontAwesome style="margin-left: 8px;" v-if="!item.disabled && item.isshowdel"
							@click="remove(index)" type="fas fa-trash-alt" size="45" fw :color="color">
						</Am-FontAwesome>
						<Am-FontAwesome style="margin-left: 8px;" v-if="!item.disabled && item.isshowscan"
							@click="sendCode(index,item.property)" type="fas fa-barcode" size="50" fw :color="color">
						</Am-FontAwesome>
						<Am-FontAwesome style="margin-left: 8px;" v-if="!item.disabled"
							@click="sendCode1(index,item.property)" type="fas fa-angle-double-right" size="50" fw
							:color="color"></Am-FontAwesome>
					</view>
					<!-- 这里是table按钮 -->
					<view class="line-right send-code-box"
						v-else-if="item.rules.flag=='62'||item.rules.flag=='61'||item.rules.flag=='60'||item.rules.flag=='59'||item.rules.flag=='57'||item.rules.flag=='17'||item.rules.flag=='58'||item.rules.flag=='56'||item.rules.flag=='55'||item.rules.flag=='54'||item.rules.flag=='52'||item.rules.flag=='13'||item.rules.flag=='4'||item.rules.flag=='5'||item.rules.flag=='7'||item.rules.flag=='8'||item.rules.flag=='9'||item.rules.flag=='51' ||item.rules.flag=='71' ||item.rules.flag=='81'">
						<input :type="item.type" :disabled="item.disabled" :adjust-position="false"
							confirm-type="search" @confirm="enter(index,item.property,$event)"
							@focus="focus(index,item.property,item.rules.value)"
							@blur="blur(index,item.property,item.rules.value)" :focus="item.firstFocus"
							:auto-blur="false" @keyup.enter="enter(index,item.property,item.rules.value)"
							:maxlength="item.maxlength" class="input" placeholder-class="plaClass"
							:placeholder='item.placeholder' v-model="item.rules.value" @input="inputVal(index)"></input>
						<Am-FontAwesome style="margin-left: 8px;" v-if="!item.disabled && item.isshowdel"
							@click="remove(index)" type="fas fa-trash-alt" size="50" fw :color="color">
						</Am-FontAwesome>
						<Am-FontAwesome style="margin-left: 8px;" v-if="!item.disabled && item.isshowscan"
							@click="sendCode(index,item.property)" type="fas fa-barcode" size="50" fw :color="color">
						</Am-FontAwesome>
						<!-- 这里的批号做了特殊处理	 && item.property.ffieldtype!=9-->
						<Am-FontAwesome style="margin-left: 8px;" v-if="(!item.disabled || item.rules.flag=='55') "
							@click="sendCode1(index,item.property)" type="fas fa-angle-double-right" size="50" fw
							:color="color"></Am-FontAwesome>
					</view>
					<!-- 普通输入框条码详情特殊处理 -->
					<view class="line-right send-code-box" v-else-if="item.rules.flag=='500'">
						<input :type="item.type" :disabled="item.disabled" :adjust-position="false"
							:maxlength="item.maxlength" class="input" placeholder-class="plaClass"
							:placeholder='item.placeholder' v-model="item.rules.value"></input>
						<Am-FontAwesome v-if="!item.disabled && item.isshowdel" @click="remove(index)"
							type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
						<Am-FontAwesome @click="barcode(index,item.property)" type="fas fa-caret-right" size="50" fw
							:color="color"></Am-FontAwesome>
					</view>

					<!-- 普通输入框源单明细特殊处理 -->
					<view class="line-right send-code-box" v-else-if="item.rules.flag=='501'">
						<input :type="item.type" :disabled="item.disabled" :adjust-position="false"
							:maxlength="item.maxlength" class="input" placeholder-class="plaClass"
							:placeholder='item.placeholder' v-model="item.rules.value"></input>
						<Am-FontAwesome v-if="!item.disabled && item.isshowdel" @click="remove(index)"
							type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
						<Am-FontAwesome @click="source(index,item.property)" type="fas fa-caret-right" size="50" fw
							:color="color"></Am-FontAwesome>
					</view>

					<!-- 普通输入框工序系列特殊处理 
					<view class="line-right send-code-box" v-else-if="item.rules.flag=='502'">
						<input :type="item.type" :disabled="item.disabled" :maxlength="item.maxlength" class="input"
							placeholder-class="plaClass" :placeholder='item.placeholder'
							v-model="item.rules.value"></input>
						<Am-FontAwesome v-if="!item.disabled && item.isshowdel" @click="remove(index)"
							type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
						<Am-FontAwesome @click="Getgxxl(index,item.property)" type="fas fa-caret-right" size="50" fw
							:color="color"></Am-FontAwesome>
					</view>-->

					<!-- 普通输入框  有回车事件-->
					<view class="line-right" v-else-if="item.rules.flag=='0'">
						<input :type="item.type" confirm-type="search"
							@confirm="inputenter(index,item.property,item.rules.value)"
							@keyup.enter="inputenter(index,item.property,item.rules.value)" :disabled="item.disabled"
							:maxlength="item.maxlength" class="input" placeholder-class="plaClass"
							:placeholder='item.placeholder' v-model="item.rules.value" @input="inputVal(index)"></input>
						<Am-FontAwesome v-if="!item.disabled && item.isshowdel" @click="remove(index)"
							type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
						<Am-FontAwesome v-if="!item.disabled && item.isshowscan" @click="sendCode(index,item.property)"
							type="fas fa-barcode" size="50" fw :color="color"></Am-FontAwesome>
					</view>
					<!-- 普通输入框 源单计算数量上推页面  有回车事件-->
					<view class="line-right" v-else-if="item.rules.flag=='999'">
						<input :type="item.type" @focus="focus(index,item.property,item.rules.value)" 
							confirm-type="search" @confirm="inputenter(index,item.property,item.rules.value)"
							@keyup.enter="inputenter(index,item.property,item.rules.value)" :disabled="item.disabled"
							:maxlength="item.maxlength" class="input" placeholder-class="plaClass"
							:placeholder='item.placeholder' v-model="item.rules.value" @input="inputVal(index)"></input>
						<Am-FontAwesome v-if="!item.disabled && item.isshowdel" @click="remove(index)"
							type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
						<Am-FontAwesome v-if="!item.disabled && item.isshowscan" @click="sendCode(index,item.property)"
							type="fas fa-barcode" size="50" fw :color="color"></Am-FontAwesome>
					</view>
					<!-- 普通输入框  没有回车事件-->
					<view class="line-right" v-else>
						<input :type="item.type" :disabled="item.disabled" :maxlength="item.maxlength" class="input"
							placeholder-class="plaClass" :placeholder='item.placeholder' v-model="item.rules.value"
							@input="inputVal(index)"></input>
						<Am-FontAwesome v-if="!item.disabled && item.isshowdel" @click="remove(index)"
							type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
						<Am-FontAwesome v-if="!item.disabled && item.isshowscan" @click="sendCode(index,item.property)"
							type="fas fa-barcode" size="50" fw :color="color"></Am-FontAwesome>
					</view>
				</view>
				<!-- 这里是条码详情碰到辅助数量就出现下划线  辅助数量的标识是1000-->
				<!-- 点击事件设置在view这里不然手机端的剪刀点击不到 -->
				<view style="text-align: right;" @click="removesource(item.index)"
					v-if="item.rules.flag=='1000' && item.rules.del">
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome style="border-style:dotted;" type="fas fa-cut" size="50" fw :color="color">
					</Am-FontAwesome>
				</view>
				<!-- 这里是物料库存查询碰到最后一个就出现下划线  firstFocus=true-->
				<view style="text-align: center;" v-if="(item.showLine || item.rules.flag=='1000') && !item.rules.del">
					<button v-if="fid=='81'" @click="updatebarcode"  :style="bjys" style="background-color: #969696;color: #ffffff;">保存</button>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome type="fas fa-ellipsis-h" size="21" fw :color="color"></Am-FontAwesome>
				
				</view>
				<!-- 日期框 -->
				<view :style="bj" class='line' v-show="item.property.fishidden==0" v-else-if="item.type=='date'">
					<view  :class="item.rules.verify.indexOf('req')!=-1 ? 'line-left' :'p-l14 line-left' "><text
							:class="!item.disabled? 'colorRed1' :'colorRed2' "><text class='colorRed'
								v-if="item.rules.verify.indexOf('req')!=-1">*</text>{{item.label+":"}}</text></view>
					<view   class="line-right">
						<picker @change="bindDateChange"  :disabled="item.disabled" @click="geindex(index,item.property)"
							:mode="item.type" v-model="item.rules.value">
							<input class="input"  @focus="focus(index,item.property,item.rules.value)"
								@blur="blur(index,item.property,item.rules.value)" type="text" :disabled="item.disabled"
								:placeholder='item.placeholder' v-model="item.rules.value" />
						</picker>
						<picker @change="bindDateChange" @click="geindex(index,item.property)" :mode="item.type"
							v-model="item.rules.value">
							<Am-FontAwesome v-if="!item.disabled" type="fas fa-calendar-alt" size="50" fw
								:color="color"></Am-FontAwesome>
						</picker>
						<Am-FontAwesome v-if="!item.disabled && item.isshowdel" @click="remove(index)"
							type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
					</view>
				</view>
				<!-- 下拉选择-->
				<view :style="bj" class='line' v-show="item.property.fishidden==0" v-else-if="item.type=='radio'">
					<view :class="item.rules.verify.indexOf('req')!=-1 ? 'line-left' :'p-l14 line-left' ">
						<text class='colorRed' v-if="item.rules.verify.indexOf('req')!=-1">*</text>{{item.label+":"}}
					</view>
					<view class="line-right">
						<input type="text" @click="selectInput(index,item.property,item.disabled)" class="input"
							placeholder-class="plaClass" @focus="focus(index,item.property,item.rules.value)"
							@blur="blur(index,item.property,item.rules.value)" :placeholder='item.placeholder'
							:disabled="item.disabled" v-model="item.rules.value">
						</input>
						<Am-FontAwesome v-if="!item.disabled" @click="selectInput(index,item.property,item.disabled)"
							type="fas fa-angle-down" size="50" fw :color="color"></Am-FontAwesome>
					</view>
				</view>
				<!--复选框销售出库赠品-->
				<view :style="bj" class='line' v-show="item.property.fishidden==0" v-else-if="item.type=='checkbox'">
					<view :class="item.rules.verify.indexOf('req')!=-1 ? 'line-left' :'p-l14 line-left' ">
						<text class='colorRed' v-if="item.rules.verify.indexOf('req')!=-1">*</text>{{item.label+":"}}
					</view>
					<view class="line-right">
						<input type="checkbox" class="input" placeholder-class="plaClass"
							:placeholder='item.placeholder' :class="item.rules.value=='1'?'iszp':'nozp'"
							:value="item.rules.value=='1'?'当前产品属于赠品':'当前产品不属于赠品'" :disabled="true">
						<checkbox-group @change="checkboxChange(index)">
							<label>
								<checkbox :disabled="item.disabled" v-model="item.rules.value" :value="item.rules.value"
									:checked="item.rules.value=='1'" />
							</label>
						</checkbox-group>
						</input>
					</view>
				</view>
				<!-- 多行文本框 -->
				<view :style="bj" class="textarea-box" v-show="item.property.fishidden==0" v-else-if="item.type=='textarea'">
					<view :class="item.rules.verify.indexOf('req')!=-1 ? 'line-left' :'p-l14 line-left' "><text
							:class="!item.disabled? 'colorRed1' :'colorRed2' "><text class='colorRed'
								v-if="item.rules.verify.indexOf('req')!=-1">*</text>{{item.label+":"}}</text></view>
					<view class="line-right">
						<textarea rows="" cols="" @confirm="inputenter(index,item.property,item.rules.value)"
							@keyup.enter="inputenter(index,item.property,item.rules.value)" :disabled="item.disabled"
							placeholder-class="plaClass" :placeholder='item.placeholder' v-model="item.rules.value"
							@input="inputVal(index)">
						</textarea>
					</view>
					<Am-FontAwesome style="margin-left: 8px;" v-if="!item.disabled && item.isshowdel"
						@click="remove(index)" type="fas fa-trash-alt" size="50" fw :color="color"></Am-FontAwesome>
					<Am-FontAwesome style="margin-left: 8px;" v-if="!item.disabled && item.isshowscan"
						@click="sendCode(index,item.property)" type="fas fa-barcode" size="50" fw :color="color">
					</Am-FontAwesome>
				</view>
			</block>
		</view>
		<view class="select-modal" v-if="show">
			<view class="select-bg" @click="cancel"></view>
			<view class="select-box" :animation="animationData">
				<view class="select-title">
					<view class="font32 color-999" @click="cancel">取消</view>
					<view :style="bjys" class="font32 color-orange" @click="sure">确定</view>
				</view>
				<view>
					<block v-for="(item,index) in selectBox" :key="index">
						<view class="select-item" @click="selectItem(item.value,index,item.rowvalue)">{{item.value}} <i
						:style="borderColor" 		class="select-flag" v-if="item.flag"></i></view>
					</block>
				</view>
			</view>
		</view>
		<mask-model ref="showMask" btnType="1" :titleContext="titleContext" @confirm="confirm" @cancel="cancel"
			:titleColoe="color" :cancelColor="color" :confirmColor="color" :maskTitle="maskTitle"></mask-model>
	</view>
</template>

<script>
	//提示框
	import maskModel from '../components/mask-model/mask-model.vue'
	//这里是图标库表单后面的图标
	import AmFontAwesome from '../components/Am-FontAwesome/index.vue';
	export default {
		components: {
			AmFontAwesome,
			maskModel
		},
		name: 'activeForm',
		data() {
			return {
				editQty: 0,
				titleContext: "",
				maskTitle: "",
				status: "",
				property: {},
				tabindex: 0,
				// 索引
				index: 0,
				date: this.getDate1({
					format: true
				}),
				startDate: this.getDate1('start'),
				endDate: this.getDate1('end'),
				submitData: "",
				show: false,
				animationData: {},
				selectBox: [],
				currentSelectIndex: "",
				currentSelectValue: "",
				wait: 60,
				isSend: false,
				sendColor: "color:#ff5b01",
				result: [],
				flagbarorsrc: false, //提示条码还是源单添加成功！
				srcno: "", //补料成功后返回的源单单号
				fiscoby: 1, //是否联副产品 1主产品,2联产品，3副产品
				disbled: 2, //1显示 2隐藏 
				FMaterialId: "", //物料编码
				fontcolor: {
					color: this.$kdup.color,
					borderBottom: '2px solid ' + this.$kdup.color
				},
				bj: {
					borderBottom: '1px dashed ' + this.$kdup.color
				},
				color: this.$kdup.color,
				bjys: {
					BackgroudColor: this.$kdup.color,
				},
				borderColor: {
					borderBottom: '4px solid ' + this.$kdup.color,
					borderRight: '4px solid ' + this.$kdup.color
				},
			}
		},
		props: {
			//表头或者表体的数据
			formDate: {
				type: Array,
				default: function() {
					return []
				}
			},
			//表头表体的全部数据
			head: {
				type: Array,
				default: function() {
					return []
				}
			},
			mainFieleKey: {
				type: Object,
				default () {
					return {}
				}
			},

			//父组件的fid
			fid: [String, Number],
		},
		mounted() {},
		methods: {
			confirm: function() { //确认按钮
				uni.showToast({
					title: '已确认',
					mask: false,
					duration: 1000,
					icon: "none"
				});
				var pages = getCurrentPages(); //当前页
				var beforePage = pages[pages.length - 1]; //上个页面
				beforePage.$vm.select();
			},
			//删除条码明细
			removesource: function(index) {
				//调用上一个页面的删除方法
				var pages = getCurrentPages(); //当前页
				var beforePage = pages[pages.length - 1]; //上个页面
				beforePage.$vm.remove(index);
			},
			//点击删除按钮删除文本
			remove: function(index) {
				var pages = getCurrentPages(); //当前页
				var beforePage = pages[pages.length - 1]; //上个页面	
				if (index == 0) { //删除条码
					beforePage.$vm.remove(beforePage.options, index);
				} else if (this.formDate[0].property.ffieldtype == 1 || this.formDate[index].property.ffieldtype == 61 || this.formDate[index].property.ffieldtype == 62) { //删除表头 
					beforePage.$vm.remove("", index);
				} else { //删除表体
					this.formDate[index].rules.value = "";
					this.formDate[index].rules.rowvalue = {
						id: "",
						name: "",
						number: ""
					};
				}
			},
			//获得焦点事件显示编码
			focus: function(index, property, id) {
			this.formDate[index].firstFocus = true;
			//console.log(property.fkeytext+"获得焦点")
				var pages = getCurrentPages(); //当前页
				var beforePage = pages[pages.length - 1]; //上个页面	
				//弹出计算方式框
				//欧骏特殊计算方式
				if (this.formDate[index].rules.flag == 999 && uni.getStorageSync("customer") === "广东欧骏科技股份有限公司" &&
					property.fcloudbillkey != "top_GXHB") {
					if (this.formDate[index].rules.value != "") {
						if (this.formDate[index].rules.rowvalue.hasOwnProperty("fqty")) {
							beforePage.$vm.show(index, this.formDate[index], this.formDate[index].rules.rowvalue.fqty);
						} else {
							beforePage.$vm.show(index, this.formDate[index], this.formDate[index].rules.rowvalue.id);
						}

					}
				} else if (this.formDate[index].rules.rowvalue.number != undefined ) {
					this.formDate[index].rules.value = this.formDate[index].rules.rowvalue.number;
				} else {
					this.formDate[index].rules.value = this.formDate[index].rules.rowvalue.id;
				}
				//这里一定要判断 上推页面
				if (this.formDate[index].rules.flag == 999 && this.formDate[index].property.fcloudbillkey !=
					"top_GXHB") {
					uni.onKeyboardHeightChange(res => {
						beforePage.$vm.inputOffsetBottom = res.height > 0 ? (res.height) : res.height;
					})
				} else {
					//这里是工序汇报的光标
					if (this.formDate[index].property.fcloudbillkey == "top_GXHB") {
						if (this.formDate[index].property.ffieldtype == "59" || this.formDate[index].property
							.ffieldtype == "17") {
								// setTimeout(function () {
								//  uni.hideKeyboard();
								// }, 100)
						}
					} else {//这里是默认获取的光标
				  setTimeout(()=> {
					uni.hideKeyboard();
				  }, 100)
					 }
				}

			},
			//失去焦点事件显示名称
			blur: function(index, property, id) {
				//console.log(property.fkeytext+"失去焦点")
				if (this.formDate[index].rules.rowvalue.name != undefined) {
					this.formDate[index].rules.value = this.formDate[index].rules.rowvalue.name;
				} else {
						//这里是工序汇报的光标
					if (this.formDate[0].property.fconfignumber == "GXHB") {
						for (var i = 0; i < this.formDate.length; i++) {
							if (this.formDate[i].hasOwnProperty("firstFocus") && this.formDate[i].property
								.ffieldtype ==
								59) {
								this.formDate[i].firstFocus = true;
							} else {
								this.formDate[i].firstFocus = false;
							}
						}
					} else {//这里是默认获取的光标
				
					}
				}
			},
			//条码库存查询保存按钮事件
			updatebarcode: function(){
				 var barcode = this.formDate[2].rules.rowvalue.id;
				 var ph = this.$kdup.getJson(this.formDate, "label", "批号").rules.rowvalue.id;
				 var scrq = this.$kdup.getJson(this.formDate, "label", "生产日期").rules.rowvalue.id;
				 var smzt = this.$kdup.getJson(this.formDate, "label", "扫描状态").rules.rowvalue.name=="未扫描"?0:1;
				 var scrq=(scrq=="")?null:"'"+scrq+"'"
				 var data={sql:"update t_bbb_barcode set  FLOT_Text='"+ph+"',FPRODUCTDATE="+scrq+",FISSCAN="+smzt+" where FNUMBER='"+barcode+"'"}
				 this.$myRequest.postRequest("LoadListJson", data).then(res => {
			     	if (res.data.hasOwnProperty("error") && !this.$kdup.isEmpty(res.data.error)) {
			     		uni.showToast({
			     			title: "保存成功！",
			     			icon: "none"
			     		});
			     	} else {
			     		uni.showToast({
			     			title: res.data.error,
			     			icon: "none"
			     		});
			     	}
			     })
			},
			//文本框回车
			inputenter: function(index, property) {
				//调用统一修改方法
				if (property.fisnosavelast == 0 && property.fscanposition != 1 && property.ffieldtype != "59" &&
					property.ffieldtype != "17") {
					this.$kdup.updateValue(this, property.ffieldname, this.formDate[index].rules.rowvalue.id, this
						.formDate[index].rules
						.rowvalue, this.fid);
				}
			},
			//判断是不是数字
			myIsNaN: function(value) {
				return typeof value === 'number' && !isNaN(value);
			},
			//隐藏和显示生产订单编号字段
			myIsdisplay: function(index, number) {
				for (var i = 0; i < this.formDate.length; i++) {
					if (this.formDate[i].property.ffieldtype == 17) {
						if (number == 1) { //显示
							this.formDate[i].rules.verify = "req"
							this.formDate[i].property.fishidden = 0;
						} else if (number == 2) { //隐藏
							this.formDate[i].rules.verify = ""
							this.formDate[i].property.fishidden = 1;
						}
					}
				}
			},
			//解析编码规则（诚展销售出库）
			//02102213802A006921073100001src:YM210731001
			CZXSCLgetbarvalue: function(bar) {
				var srcIndex = bar.indexOf("src:");
				return {
					src: bar.substring(srcIndex + 4, bar.length)
				}
			},
			//解析编码规则 (欧骏生产入库)
			//01100018100265202011000001src:CGSL201130101.20002seq:1
			OJSCRKgetbarvalue: function(bar) {
				var srcIndex = bar.indexOf("src:");
				var seqIndex = bar.indexOf("seq:");
				return {
					src: bar.substring(srcIndex + 4, seqIndex),
					seq: bar.substring(seqIndex + 4, bar.length),
					bar: bar.substring(0, srcIndex)
				}
			},
			//解析编码规则 (欧骏采购入库)
			//01101101122243210505000001;supp=1.00052;src=OJ20210505-04
			OJCGRKgetbarvalue: function(bar) {
				var srcIndex = bar.indexOf("src=");
				var suppIndex = bar.indexOf(";supp=");
				return {
					bar: bar.substring(0, suppIndex),
					src: bar.substring(srcIndex + 4, srcIndex.length)
				}
			},
			//解析编码规则 (韩立德生成入库直接)
			//MO0000271-1
			HLDSCRKgetbarvalue: function(bar) {
				var index = bar.lastIndexOf("\-");
				return {
					src: bar.substring(0, index),
					seq: bar.substring(index + 1, bar.length)
				}
			},
			//解析编码规则 (韩立德采购入库)处理获取源单单号
			//http://weixin.qq.com/r/oSooMO3EMrBNralT93_z;01100328112256210924008;supp=1007;src=CGDD20210924006;batch=
			HLDCGRKgetbarvalue: function(bar) {
				var srcIndex = bar.indexOf("src=");
				var batchIndex = bar.indexOf(";batch=");
				return bar.substring(srcIndex + 4, batchIndex)
			},
			//处理工序截取的问题/工序带生产订单  MO20220103002-1GX:TEST01Qty:55
			GetGXValue: function(bar) {
				var valIndex = bar.indexOf("GX:");
				var qtyIndex = bar.indexOf("Qty:");
				var index = bar.lastIndexOf("\-");
				return {
					number: bar.substring(valIndex + 3, qtyIndex),
					mobillno: bar.substring(0, index),
					seq: bar.substring(index + 1, valIndex),
					qty: bar.substring(qtyIndex + 4, bar.length),
				}
			},
			//扫描第一道工序的时候反写开工时间/提交的时候反写完工时间
			firstGx: function(num) {
				var data = {
					sql: "select FStartDatetime,FEndDatetime  from top_TerminalData where fid=" + this.fid
				}
				this.$myRequest.postRequest("LoadListJson", data).then(res => {
					if (num == 1) {
						if (res.data.Table[0].fstartdatetime == "0001-01-01 00:00") {
							this.$kdup.updateValue(this, "fstartdatetime", new Date(+new Date() + 8 * 3600 *
								1000).toJSON().substr(0, 19).replace("T", " "), "", this.fid)
						} else {
							this.$kdup.updateValue(this, "fstartdatetime", new Date(+new Date() + 8 * 3600 *
								1000).toJSON().substr(0, 19).replace("T", " "), "", this.fid)
						//	console.log(new Date(+new Date() + 8 * 3600 * 1000).toJSON().substr(0, 19).replace(
						//		"T", " "), "")
						}
					} else if (num == 2) {
						if (res.data.Table[0].fenddatetime == "0001-01-01 00:00") {
							this.$kdup.updateValue(this, "fenddatetime", new Date(+new Date() + 8 * 3600 *
								1000).toJSON().substr(0, 19).replace("T", " "), "", this.fid)
						} else {
							this.$kdup.updateValue(this, "fenddatetime", new Date(+new Date() + 8 * 3600 *
								1000).toJSON().substr(0, 19).replace("T", " "), "", this.fid)
						//	console.log(new Date(+new Date() + 8 * 3600 * 1000).toJSON().substr(0, 19).replace(
						//		"T", " "), "")
						}
					}
				})
			},
			//获取物料编码
			// getmobillno:function() {
			// var FMaterialIdObj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key", "FSCDJBillNo")
			// if(!this.$kdup.isEmpty(FMaterialIdObj)){
			// 	 this.FMaterialId=FMaterialIdObj.rules.rowvalue.fnumber;
			// }	
			// },
			//工序插入源单 ,"+data.fseq+"
			insertSRC: function(data) {
				var str = " select * from top_TerminalDataEntry_Src where FSRCBILLNO='" + data.fbillno +
					"' and  FSRCENTRYSEQ=" + data.fseq + "  and fid=" + this.fid;
				var cfobj = {
					sql: str
				}
				this.$myRequest.postRequest("LoadListJson", cfobj).then(res1 => {
					if (res1.data.hasOwnProperty("error") && !this.$kdup.isEmpty(res1.data.error)) {
						var sql =
							"insert into top_TerminalDataEntry_Src(FID,FEntryID,FSRCBILLTYPE,FSRCBILLNO,FSRCENTRYSEQ,FSRCMATERIALID,FSRCUNITID,FSRCQTY,FSRCINTERID,FSRCENTRYID,FSRCAUXPROPID) " +
							" values(" + this.fid + "," + data.fentryid + ",'PRD_MO','" + data.fbillno+ "'," +
							data.fseq + "," + data.fmaterialid + "," + data.unitid + "," + parseFloat(data[
								"数量"]) + "," + data.fid + "," + data.fentryid1 + ",0);"
						var obj = {
							sql: sql
						}
						this.$myRequest.postRequest("LoadListJson", obj).then(res => {
							if (res.data.hasOwnProperty("error") && !this.$kdup.isEmpty(res.data
								.error)) {
								uni.showToast({
									title: "生产订单添加成功!",
									icon: "none",
								});
							} else {
								uni.showToast({
									title: res.data.error,
									icon: "none"
								});
							}
						})
					} else {
						uni.showToast({
							title: "生产订单已存在无需重复扫描！",
							icon: "none",
						});

					}
				})//光标跳转到工序字段
				if (this.formDate[0].property.fconfignumber == "GXHB") {
					for (var i = 0; i < this.formDate.length; i++) {
						if (this.formDate[i].hasOwnProperty("firstFocus") && this.formDate[i].property.ffieldtype ==
							59) {
							this.formDate[i].firstFocus = true;
						} else {
							this.formDate[i].firstFocus = false;
						}
					}
				}
			},
			//文本框外的键盘回车事件 index是写入第几个   property是他的属性   id是需要查询的number也可以是value有时候是对象
			enter: function(index, property, id) {
				//这里是扫描枪和摄像头扫码处理
				var pages = getCurrentPages(); //获取每个页面的对象 
				var beforePage = pages[pages.length - 2]; //上个页面
				if (beforePage.$vm.updatetitle == undefined) {
					beforePage = pages[pages.length - 1]; //上两个页面
				}
				var seq; //行号
				var bar; //条码
				var src; //源单
				//console.log("解析前：" + JSON.stringify(id))
				if (id instanceof Object) {
					//这里是处理编码规则的字符串
					if (id.hasOwnProperty("target")) { //pda扫码
						if (id.target.value.indexOf("seq") != -1 && id.target.value.indexOf("src") != -1) {
							if (this.formDate[index].property.ffieldtype == 6) { //扫描条码
								var obj = this.OJSCRKgetbarvalue(id.target.value);
								if (this.formDate[index].property.fconfignumber == "PRD_PickMtrl_Yes") {
									id = obj.bar;
								} else {
									id = obj.bar;
									seq = obj.seq;
									src = obj.src;
								}
								//注意这个是欧骏采购入库单特别需求需要扫描的条码对应源单
								// if(uni.getStorageSync("customer")=="广东欧骏科技股份有限公司" && this.formDate[index].property.fconfignumber=="STK_InStock_Yes"){
								// 	seq = this.OJSCRKgetbarvalue(id.target.value).seq;
								// 	bar = this.OJSCRKgetbarvalue(id.target.value).bar;
								// }
							} else { //扫描源单
								seq = this.OJSCRKgetbarvalue(id.target.value).seq;
								bar = this.OJSCRKgetbarvalue(id.target.value).bar;
								id = this.OJSCRKgetbarvalue(id.target.value).src;
							}
							//这里特殊处理欧骏的根据“采购入库单”的物料编码规则
						} else if (id.target.value.indexOf("supp") != -1 && id.target.value.indexOf("src") != -1 && uni
							.getStorageSync("customer") != "") {
							if (this.formDate[index].property.ffieldtype == 6) { //扫描条码
								id = id.target.value;
									console.log("解析后1：" + JSON.stringify(id))
							} else { //扫描源单
								id = this.OJCGRKgetbarvalue(id.target.value).src;
								console.log("解析后2：" + JSON.stringify(id))
							}
							//这里特殊处理诚展的根据“销售出库”的物料编码规则
						} else if (id.target.value.indexOf("src") != -1 && uni.getStorageSync("customer") !=
							"广东温道科技有限公司") {
							id = this.CZXSCLgetbarvalue(id.target.value).src;
						} else if (id.target.value.indexOf("GX:") == -1) {
							//这个就是是对象但是不包含seq和src
							//处理单个“-”
							var n = (id.target.value.split('-')).length - 1;
							//this.getmobillno();
							//支持翰立德的-行号和欧骏的生产入库带行号
							if (n == 1 && (this.formDate[index].property.ffieldtype != 6 || uni.getStorageSync(
										"customer") ==
									"广东温道科技有限公司" || this.formDate[index].property.fconfignumber == "PRD_INSTOCK_Pro"
									)) {
								seq = this.HLDSCRKgetbarvalue(id.target.value).seq;
								id = this.HLDSCRKgetbarvalue(id.target.value).src;
							} else {
								//这里特殊处理欧骏的根据“生产领料单”号带出“生产用料清单”   处理多个“-”
								id = id.target.value;
							}
						}
					} else { //双击表格放回
						seq = id.seq; //seq最先
						id = id.number;
					} //包含seq同时src
				} else if (id.indexOf("seq") != -1 && id.indexOf("src") != -1) { //这里处理手机摄像头扫码字符串
					if (this.formDate[index].property.ffieldtype == 6) { //扫描条码
						id = this.OJSCRKgetbarvalue(id).bar;
					} else { //扫描源单
						seq = this.OJSCRKgetbarvalue(id).seq;
						bar = this.OJSCRKgetbarvalue(id).bar;
						id = this.OJSCRKgetbarvalue(id).src;
					} //包含supp同时src
				} else if (id.indexOf("supp") != -1 && id.indexOf("src") != -1) {
					console.log("解析后：" + JSON.stringify(id))
					if (this.formDate[index].property.ffieldtype == 6) { //扫描条码
						//id = this.OJCGRKgetbarvalue(id).bar;
					} else { //扫描源单
						id = this.OJCGRKgetbarvalue(id).src;
					}
				} else if (id.indexOf("src") != -1 && uni.getStorageSync("customer") != "广东温道科技有限公司") {
					id = this.CZXSCLgetbarvalue(id).src;
				} else if (id.indexOf("GX:") == -1) {
					//这个就是是字符串但是不包含seq和src
					//处理单个“-”
					var n = (id.split('-')).length - 1;
					//支持翰立德的-行号和欧骏的生产入库带行号
					//this.getmobillno();
					if (n == 1 && (this.formDate[index].property.ffieldtype != 6 || uni.getStorageSync("customer") ==
							"广东温道科技有限公司" || this.formDate[index].property.fconfignumber == "PRD_INSTOCK_Pro")) {
						seq = this.HLDSCRKgetbarvalue(id).seq;
						id = this.HLDSCRKgetbarvalue(id).src;
					}	
				}
				
				
				//处理韩立德快速扫描
				if (this.formDate[index] != undefined && this.formDate[index].property.ffieldtype == 13 && this
					.formDate[0].property.fastscanstatus == 1) {
					if (!(/^[A-Z][A-z0-9]*$/).test(id)) { //扫源单是大写的时候为条码
						if (this.myIsNaN(parseInt(id.substring(0, 4))) || id.substring(0, 4) == "http") {
							//条码
							bar = id;
							this.flagbarorsrc = true;
						} else {
							//源单
							bar = "";
						}
					}
				}
				//库位选择时，获取仓库Id
				var stockId = 0;
				if (property.ffieldtype == "8" && this.mainFieleKey.sp.fkey == property.fkey || property.ffieldtype ==
					"9") {
					var stockKey = this.mainFieleKey.stock.fkey;
					var stockObj = this.$kdup.getJson(this.head, "key", stockKey);
					stockId = stockObj.rules.rowvalue.id;
				} else if (property.ffieldtype == "81" && this.mainFieleKey.spTo.fkey == property.fkey || property
					.ffieldtype == "9") {
					var stockKey = this.mainFieleKey.stockTo.fkey;
					var stockObj = this.$kdup.getJson(this.head, "key", stockKey);
					stockId = stockObj.rules.rowvalue.id;
				}
				//选择源单单号的时候先获取源单类型
				var sourcetypeId = "";
				if (property.ffieldtype == "13") {
					var sourcetype = this.$kdup.mainFieleKey.srcType.fkey;
					sourcetypeId = this.$kdup.getJson(this.formDate, "key", sourcetype);
					sourcetypeId = sourcetypeId.rules.rowvalue.id
					if (this.$kdup.isEmpty(sourcetypeId)) {
						uni.showToast({
							title: "请先输入源单类型",
							icon: "none"
						});
						return;
					}
				}
				//处理解析过过滤条件
				var filter = this.$kdup.getFilter(this.head.length != 0 ? this.head : this.formDate, property.ffilter);
				var sqlParam = property.fbilllistsql;
				if (!this.$kdup.isEmpty(sqlParam))
					sqlParam = this.$kdup.getFilter(this.head.length != 0 ? this.head : this.formDate, sqlParam);
				//条码内码
				var barid = 0,
					barkey = this.$kdup.mainFieleKey.barcode.fkey;
				if (!this.$kdup.isEmpty(barkey)) {
					var barobj = this.$kdup.getJson(this.head, "key", barkey)
					if (!this.$kdup.isEmpty(barobj)) {
						barid = barobj.rules.rowvalue.id;
					}
				}
				//处理韩立德的公众号问题   源单ffieldtype=13
				if (uni.getStorageSync("customer") == "广东温道科技有限公司" && id.indexOf("http") != -1 && this.formDate[index]
					.property.ffieldtype == 6) {
					id = barid;
					// //http://weixin.qq.com/r/oSooMO3EMrBNralT93_z;01100328112256210924008;supp=1007;src=CGDD20210924006;batch=   处理获取源单单号
				} else if (uni.getStorageSync("customer") == "广东温道科技有限公司" && id.indexOf("http") != -1 && this.formDate[
						index]
					.property.ffieldtype == 13 && id.indexOf("src") != -1) { //不包含src
					//id=this.HLDCGRKgetbarvalue(id);
				}

				//处理工序截取的问题/工序带生产订单
				var gxqty = 0;
				if (id.hasOwnProperty("target")) {
					if (id.target.value.indexOf("GX:") != -1) {
						if (property.ffieldtype == 59) {
							//this.getmobillno();
							var rid = id.target.value;
							var rid1 = id.target.value;
							var rid2 = id.target.value;
							id = this.GetGXValue(id.target.value).number;
							bar = this.GetGXValue(rid).mobillno;
							seq = this.GetGXValue(rid1).seq;
							gxqty = this.GetGXValue(rid2).qty;
						} else if (property.ffieldtype == 17) {
							var rid = id.target.value;
							var rid1 = id.target.value;
							id = this.GetGXValue(id.target.value).mobillno;
							seq = this.GetGXValue(rid).seq;
							gxqty = this.GetGXValue(rid1).qty;
						}
					}
				} else {
					if (id.indexOf("GX:") != -1) {
						if (property.ffieldtype == 59) {
							//this.getmobillno();
							var rid = id;
							var rid1 = id;
							var rid2 = id;
							id = this.GetGXValue(id).number;
							bar = this.GetGXValue(rid).mobillno;
							seq = this.GetGXValue(rid1).seq;
							gxqty = this.GetGXValue(rid2).qty;
						} else if (property.ffieldtype == 17) {
							var rid = id;
							var rid1 = id;
							id = this.GetGXValue(id).mobillno;
							seq = this.GetGXValue(rid).seq;
							gxqty = this.GetGXValue(rid1).qty;
						}
					}
				}
				//处理操作员替换字符串146;63;1
				id = property.ffieldname == "FCZY" && property.ffieldtype == "57" && id.indexOf(";") != -1 ? "'" + id
					.replace(/;/g, "','") + "'" : id;
				var data = {
					fieldType: property.ffieldtype, //类型
					key: property.fformkeyid, //标识
					orgId: 0, //组织id
					filter: filter, //过滤条件
					currentValue: id, //当前行值
					stockId: stockId, //仓库id
					fid: this.fid, //单据id
					finorout: property.finorout, //是否入库
					auxKey: property.fauxformkeyid, //辅助属性
					sourcetypeId: sourcetypeId, //源单类型
					sql: sqlParam, //解析后的过滤条件
					fieldkey: property.fkey, //字段唯一的标识
					bcdId: barid, //条码内码
					seq: seq, //行号
					fconfignumber: this.formDate[0].property.fconfignumber, //单据唯一的标识
					fastscanstatus: this.formDate[0].property.fastscanstatus == undefined ? 0 : this.formDate[0]
						.property.fastscanstatus, //是否开启快速扫描
					countscheme: this.$kdup.countscheme, //过滤盘点方案的条码
					bar: bar, //源单包含的条码
					src: src, //条码包含的源单
					customer: uni.getStorageSync("customer"), //客户名称
					materialFnumber: this.FMaterialId //物料编码
				};
			
				//找到和property.fuseorgkey匹配的对象
				if (!this.$kdup.isEmpty(property.fuseorgkey)) {
					var useOrgCtrl = this.$kdup.getKey(this.head.length != 0 ? this.head : this.formDate, property
						.fuseorgkey);
					if (useOrgCtrl == null) {
						uni.showToast({
							title: "[" + property.ftitle + "]的使用组织配置不正确,请联系管理员!",
							icon: "none",
							duration: 3000
						});
						return;
					}
					//找到匹配的对象的值是不是空的，空的提示匹配对象先填
					if (this.$kdup.isEmpty(useOrgCtrl.rules.rowvalue.id) || useOrgCtrl.rules.rowvalue.id == "0" ||
						useOrgCtrl.rules.rowvalue.name == undefined) {
						uni.showToast({
							title: "请先输入[" + useOrgCtrl.property.ftitle + "]",
							icon: "none",
							duration: 3000
						});
						return;
					}
					//匹配对象填好后进入orgId=填好的值
					data.orgId = useOrgCtrl.rules.rowvalue.id
				}
				//碰到点击图标的时候fuseorgkey是不是为空，为空直接打开表格，不为空找到匹配的对象
				var returnData;
				this.$myRequest.postRequest("GetBaseDataValue", data).then(res => {
					returnData = res.data;
					//console.log(returnData)
					if (res.data.hasOwnProperty("error") && !this.$kdup.isEmpty(res.data.error)) {
						this.titleContext = property.ftitle + ":回车提示";
						this.maskTitle = res.data.error;
						console.log(this.maskTitle)
						this.$refs.showMask.show()
						//未找到清空数据
						this.formDate[index].rules.value = "";
						this.formDate[index].rules.rowvalue = {
							id: ""
						};
						return;
					}
					//生产补料/委外补料提示
					if (res.data.hasOwnProperty("msg") && !this.$kdup.isEmpty(res.data.msg)) {
						var that = this;
						var sourcetype = that.mainFieleKey;
						that.sourcetypeId = that.$kdup.getJson(that.head, "key", sourcetype);
						var data = {
							sourcetypeId: that.sourcetypeId
						}
						var billno = ""; //源单单号
						if (res.data.msg == "物料不在源单中是否补料?") {
							uni.showModal({
								title: '补料提示',
								content: res.data.msg,
								success: function(res1) {
									if (res1.confirm) {
										beforePage.$vm.pageactive();
									} else if (res1.cancel) {
										beforePage.$vm.remove(beforePage.options, index);
									}
								}
							});
						} else
						if (res.data.msg == "请确认条码为联副产品?") {
							uni.showActionSheet({
								itemList: ['联产品', '副产品'],
								success(result) {
									if (result.tapIndex == 0) { //联产品
										that.fiscoby = 2;
										console.log("联产品")
									} else { //副产品
										that.fiscoby = 3;
										console.log("副产品")
									}
									//显示生产订单编号
									this.disbled = 1;
									that.myIsdisplay(index, this.disbled);
								},
								fail(result) {
									beforePage.$vm.remove(beforePage.options, index);
								}
							})
						}
					} else { //如果不是上面这种情况则隐藏生产订单编号控件
						//如果不等于补料单/生产、委外，工序汇报  就显示生产订单编号控件
						if (property.fcloudbillkey != "PRD_FeedMtrl" || property.fcloudbillkey !=
							"SUB_FEEDMTRL") {
							if (property.fcloudbillkey != "top_GXHB") {
								this.myIsdisplay(index, this.disbled)
							}
						}
					}
					//判断是否开启批次管理
					if (property.fcloudbillkey == "STK_LOTADJUST" && res.data.Table[0].isbatchmgr == "0") {
						uni.showToast({
							title: "该条码未开启批次管理！",
							icon: "none"
						});
						return;
					}
					//回调方法
					var dbCtrl = this.formDate[index];
					if (dbCtrl.hasOwnProperty("isEnterCallBack") && dbCtrl.isEnterCallBack) {
						if (beforePage.$vm.hasOwnProperty("enterCallbackFunc")) {
							beforePage = pages[pages.length - 1]; //上两个页面 
						} else {
							beforePage = pages[pages.length - 2]; //上两个页面 
						}
						beforePage.$vm.enterCallbackFunc(index, res.data)
						return;
					}
					//源单返回
					if (property.ffieldtype == "13") {
						//源单里面如果包含其他控件内容应直接赋值
						if (!this.$kdup.isEmpty(res.data.srcRule)) {
							var obj = JSON.parse(res.data.srcRule);
							for (var i = 0; i < obj.length; i++) {
								var key = this.$kdup.getJson(this.formDate, "key", obj[i].key);
								//if (this.$kdup.isEmpty(key.rules.value)) {//这里是设置如果没值才反写
									if (!this.$kdup.isEmpty(obj[i].value.name)) {
										key.rules.value = obj[i].value.name;
									} else {
										key.rules.value = obj[i].value.id;
									}
									key.rules.rowvalue = obj[i].value;
									this.$kdup.updateValue(this, key.property.ffieldname, obj[i].value.id,
										key.rules.rowvalue, this.fid)
								//}
							}
						}
						if (this.flagbarorsrc) { //扫源单是大写的时候为条码
							uni.showToast({
								title: "条码添加成功!",
								icon: "none"
							});
							this.formDate[index].rules.value = "";
							this.formDate[index].rules.rowvalue = {
								id: ""
							};
						} else {
							uni.showToast({
								title: "源单单号添加成功!",
								icon: "none"
							});	
							
						}
						for (var i = 0; i < this.formDate.length; i++) {
							if (this.formDate[i].property.ffieldtype == "13") {
								this.formDate[i].rules.value = "";
								this.formDate[i].rules.rowvalue = {
									id: ""
								};
									
							}
						}
						
						return;
					}
					//批号返回数量等于批号库存数      MO20220308014
					if (property.ffieldtype == "9") {
						var qty = this.$kdup.getJson(this.formDate, "key", "FBarcodeQty")
						if (qty == null) {
							qty = this.$kdup.getJson(this.formDate, "key", "FQty")
						}
						if (this.status != 1) { //编辑状态不反写
							qty.rules.value = parseFloat(res.data.Table[0]["库存数量"]);
							qty.rules.rowvalue = {
								id: parseFloat(res.data.Table[0]["库存数量"])
							}
							this.AfreshFenPei(parseFloat(res.data.Table[0]["库存数量"]));
						}
					}
					if (property.ffieldtype == "59") {
						//赋值汇报数量  res.data.Table[0].fqty已汇报数  res.data.Table[0].fjhqty计划总数   res.data.Table[0].fmastqty 已扫描数量
						if (this.$kdup.isEmpty(res.data.Table[0].fjhqty)) {
							res.data.Table[0].fjhqty = 0;
						}
						if ((parseFloat(res.data.Table[0].fjhqty) + parseFloat(res.data.Table[0].fxzbl)) >= (parseFloat(res.data.Table[0].fqty) + parseFloat(res
								.data.Table[0].fmastqty))) {
							this.formDate[this.$kdup.getindex1(this.formDate)].rules.value = (parseFloat(res.data.Table[0].fjhqty) + parseFloat(res.data.Table[0].fxzbl))
							 - (parseFloat(res.data.Table[0].fqty) + parseFloat(res.data.Table[0].fmastqty));
							this.formDate[this.$kdup.getindex1(this.formDate)].rules.rowvalue.id = (parseFloat(res.data.Table[0].fjhqty) + parseFloat(res.data.Table[0].fxzbl))
							 - (parseFloat(res.data.Table[0].fqty) + parseFloat(res.data.Table[0].fmastqty));
						} else {
							uni.showToast({
								title: '已扫描数量:' + parseFloat(res.data.Table[0].fmastqty) + ',已汇报数量:' +
									parseFloat(res.data.Table[0].fqty) + ',超出汇报数量：' + res.data.Table[0]
									.fjhqty,
								icon: 'none',
								duration: 2500
							});
							this.formDate[this.$kdup.getindex1(this.formDate) - 1].rules.value = "";
							this.formDate[this.$kdup.getindex1(this.formDate) - 1].rules.rowvalue.id = "";
							return;
						}
						//扫描第一道工序的时候反写开工时间
						this.firstGx(1);
						//保存工序的插入数据
						this.$kdup.GxData = res.data.Table[0];
					} else
					if (property.ffieldtype == "17") {
						//插入生产订单
						this.insertSRC(res.data.Table[0]);
						for (var i = 0; i < this.formDate.length; i++) {
							if (this.formDate[i].property.ffieldtype == "17") {
								this.formDate[i].rules.value = "";
								this.formDate[i].rules.rowvalue = {
									id: ""
								};
							}
						}
						return;
					}
					//这里是已经扫描过的再次扫码调出来之前的
					if (res.data.hasOwnProperty("entryid") && property.fformkeyid == "top_v_barcode") {
						uni.showToast({
							title: '条码已扫描目前是编辑状态',
							icon: 'none',
							duration: 2500
						});
						beforePage.$vm.updatetitle(beforePage.options.title + "(编辑中)");
						this.status = 1;
						//这里处理快速扫描
						var entryInput = res.data.entryInput;
						var entryArray = JSON.parse(entryInput);
						//在这里entryArray就是res.data
						if (entryArray.hasOwnProperty("Table") || entryArray.hasOwnProperty("error")) {
							//记得如果是快速扫描的话这里的条码是空的得自己重新赋值
							this.formDate[this.$kdup.getindex(this.formDate) - 1].rules.value = entryArray
								.Table[0].number;
							this.formDate[this.$kdup.getindex(this.formDate) - 1].rules.rowvalue = entryArray
								.Table[0];
							//编辑状态设置
							this.formDate[this.$kdup.getindex(this.formDate) - 1].rules.rowvalue["entyid"] =
								res.data.entryid;
							this.formDate[this.$kdup.getindex(this.formDate)].rules.value = entryArray.Table[0]
								.matnumber + "(" + entryArray.Table[0].matname + ")";
							this.formDate[this.$kdup.getindex(this.formDate) + 1].rules.value = entryArray
								.Table[0].matmodel;
							this.formDate[this.$kdup.getindex(this.formDate) + 2].rules.value = entryArray
								.Table[0].unitname;
							//这里根据选择依次解锁   
							this.$kdup.unLock(this.formDate, entryArray, entryArray.smallBars,
								entryArray.srcInfos, this)
							//显示辅助属性
							this.formDate = this.$kdup.hideAuxproperty(entryArray.Table[0].auxproptykeys,
								this.formDate[this.$kdup.getindex(this.formDate) - 1].property
								.auxproptykeys,
								this.formDate);
						} else { //这里是普通扫描的编辑方式
							for (var i = 0; i < entryArray.length; i++) {
								var entryObj = entryArray[i];
								var ctrlObj = this.$kdup.getJson(this.formDate, "key", entryObj.key);
								if (ctrlObj.property.ffieldtype == 6) { //条码
									ctrlObj.rules.rowvalue = entryObj.value;
									ctrlObj.rules.rowvalue["entyid"] = res.data.entryid;
									//产品类型联副产品编辑赋值
									this.fiscoby = res.data.fproducetype;
									//再次扫码调出来赋值控件  这里是表体新增控件
									this.formDate[this.$kdup.getindex(this.formDate)].rules.value = entryObj
										.value.matnumber + "(" + entryObj.value.matname + ")";
									this.formDate[this.$kdup.getindex(this.formDate) + 1].rules.value =
										entryObj.value.matmodel;
									this.formDate[this.$kdup.getindex(this.formDate) + 2].rules.value =
										entryObj.value.unitname;
									//解锁辅助属性
									this.formDate = this.$kdup.unLockAuxproperty(this.formDate[this.$kdup
											.getindex(this.formDate) - 1].property.auxproptykeys, this
										.formDate);
									//编辑的时候条码详情处理
									if (!this.$kdup.isEmpty(res.data.smallBars)) {
										var obj = res.data.smallBars;
										var sum = 0;
										var smallBars = [];
										//初始化的时候条码详情对象删除掉，自己初始化
										obj.forEach(function(e) {
											sum += parseFloat(e.fqty);
											smallBars.push(e);
										});
										//条码详情控件以及赋值
										this.formDate = this.$kdup.getBarcodeDetail(this.formDate, entryArray[
											0].value, obj.length, sum, obj);
									}
									//编辑的时候源单明细处理
									if (!this.$kdup.isEmpty(res.data.srcInfos) && res.data.srcInfos.length >
										0) {
										var obj = res.data.srcInfos;
										var sum = 0;
										var srcInfos = [];
										//初始化的时候条码详情对象删除掉，自己初始化
										obj.forEach(function(e) {
											sum += parseFloat(e.fqty);
											srcInfos.push(e);
										});
										//源单明细控件以及赋值
										this.formDate = this.$kdup.getSourceDetail(this.formDate, entryArray[0]
											.value, obj.length, sum, obj);
									}
								} else {
									//除了条码其他的rowvalue赋值 因为条码有entyid区分0新增1修改
									ctrlObj.rules.rowvalue = entryObj.value;
								}
								//再次扫码调出来解锁控件
								//解锁仓库
								if (ctrlObj.property.ffieldtype == 7) {
									//编辑的时候包装条码汇总  不知道这里为什么要放在仓库这里，放在条码哪里，编辑的时候解锁不了仓库
									if (entryArray[0].value.isbarcodemgr == 1) {
										if (ctrlObj.property.finorout == 1 || ctrlObj.property.finorout == 2 ||
											ctrlObj.property.finorout == -2) {
											ctrlObj.disabled = false; //解锁仓库
										} else {
											ctrlObj.disabled = true; //锁定仓库
										}
									} else {
										ctrlObj.disabled = false; //解锁仓库
									}
								}
								//解锁库存状态
								else if (ctrlObj.property.ffieldtype == 54) {
									if (entryArray[0].value.isbarcodemgr == 1) {
										if (ctrlObj.property.finorout == 1 || ctrlObj.property.finorout == 2 ||
											ctrlObj.property.finorout == -2) {
											ctrlObj.disabled = false; //解锁库存状态
										} else {
											ctrlObj.disabled = true; //锁定库存状态
										}
									} else {
										ctrlObj.disabled = false; //解锁库存状态
									}
								}
								//解锁库位
								else if (ctrlObj.property.ffieldtype == 8 || ctrlObj.property.ffieldtype ==
									81) {
									var tempStockKey = ctrlObj.property.ffieldtype == 8 ? this.$kdup
										.mainFieleKey.stock.fkey : this.$kdup.mainFieleKey.stockTo.fkey;
									var stock = this.$kdup.getJson(this.formDate, "key", tempStockKey)
									if (stock.rules.rowvalue.isopenlocation == 0) {
										ctrlObj.rules.verify = "" //非必录
										ctrlObj.disabled = true; //锁定库位
									} else if (entryArray[0].value.isbarcodemgr == 0 || ctrlObj.property
										.ffieldtype == 81) {
										ctrlObj.rules.verify = "req" //必录
										ctrlObj.disabled = false; //解锁库位
									} else if (ctrlObj.property.finorout == 1 || ctrlObj.property.finorout ==
										2 || ctrlObj.property.finorout == -2) {
										ctrlObj.rules.verify = "req" //必录
										ctrlObj.disabled = false; //解锁库位
									} else {
										ctrlObj.rules.verify = "" //非必录
										ctrlObj.disabled = true; //锁定库位
									}
								}
								//解锁批号
								else if (ctrlObj.property.ffieldtype == 9) {
									if (entryArray[0].value.isbatchmgr == 0) {
										ctrlObj.rules.verify = "" //非必录	
										ctrlObj.disabled = true; //锁定批号
									} else if (entryArray[0].value.isbarcodemgr == 0) {
										//ctrlObj.type = "number";
										//ctrlObj.rules.flag = 999;
										ctrlObj.rules.verify = "req" //必录
										ctrlObj.disabled = false; //解锁批号
									} else if (ctrlObj.property.finorout == 1 || ctrlObj.property.finorout ==
										2 || ctrlObj.property.finorout == -2) {
										//入库是文本出库是选择
										ctrlObj.rules.verify = "req" //必录
										ctrlObj.disabled = false; //解锁批号
									} else {
										ctrlObj.rules.verify = "" //非必录
										ctrlObj.disabled = true; //锁定批号
									}
								}
								//解锁有效期
								else if (ctrlObj.property.ffieldtype == 10) {
									if (entryArray[0].value.iskfperiod == 0) {
										ctrlObj.rules.verify = "" //非必录
										ctrlObj.disabled = true; //锁定有效期
									} else if (entryArray[0].value.isbarcodemgr == 0) {
										ctrlObj.rules.verify = "req" //必录
										ctrlObj.disabled = false; //解锁有效期
									} else if (ctrlObj.property.finorout == 1 || ctrlObj.property.finorout ==
										2 || ctrlObj.property.finorout == -2) {
										ctrlObj.rules.verify = "req" //必录	
										ctrlObj.disabled = false; //解锁有效期
									} else {
										ctrlObj.rules.verify = "" //非必录
										ctrlObj.disabled = true; //锁定有效期
									}
								}
								//生产订单编号
								else if (ctrlObj.property.ffieldtype == 17) {
									//如果是联副产品则解锁否则锁定
									if (res.data.fproducetype != "" || ctrlObj.property.fcloudbillkey ==
										"PRD_FeedMtrl" || ctrlObj.property.fcloudbillkey == "SUB_FEEDMTRL") {
										ctrlObj.rules.verify = "req" //非必录
										ctrlObj.disabled = false; //解锁生产订单编号
										ctrlObj.property.fishidden = 0; //显示字段	
									}
								}
								//解锁数量
								else if (ctrlObj.property.ffieldtype == 11) {
									if (entryArray[0].value.barcodetype != 1) {
										ctrlObj.rules.verify = "req" //必录
										ctrlObj.disabled = true; //解锁数量 
										this.editQty = entryObj.value.id;
									} else {
										this.editQty = entryObj.value.id;
										ctrlObj.rules.verify = "" //必录
										ctrlObj.disabled = true; //解锁数量 
									}
								} else if (ctrlObj.property.ffieldtype != 500 && ctrlObj.property.ffieldtype !=
									501) {
									ctrlObj.disabled = false;
								}
								//赋值方式如果类型是以下则不这样赋值
								if (ctrlObj.property.ffieldtype != 500 && ctrlObj.property.ffieldtype != 501) {
									if (entryObj.value.hasOwnProperty("name"))
										ctrlObj.rules.value = entryObj.value.name;
									else if (entryObj.value.hasOwnProperty("number"))
										ctrlObj.rules.value = entryObj.value.number;
									else ctrlObj.rules.value = entryObj.value.id;
								}
							}
						}
						return;
					}
					//选择生产订单赋值新增控件（工序汇报）
					//if(property.fcloudbillkey == "top_GXHB" && property.ffieldtype == 17){
					//this.FMaterialId=res.data.Table[0].fnumber;
					// this.formDate[this.$kdup.getindex1(this.formDate)].rules.value = res.data.Table[0].fnumber
					// 	 + "(" + res.data.Table[0].fname + ")";
					// this.formDate[this.$kdup.getindex1(this.formDate) + 1].rules.value = res.data.Table[0]
					// 	.fspecification;
					// this.formDate[this.$kdup.getindex1(this.formDate) + 2].rules.value = res.data.Table[0]
					// 	.unitname;
					// 	this.formDate[this.$kdup.getindex1(this.formDate) + 3].rules.value =parseFloat(res.data.Table[0]["数量"]);
					//this.$kdup.addGxhb(this.formDate,0,0);		
					//}
					//选择条码赋值新增控件
					if (res.data.Table[0].barcodetype != null && property.ffieldtype == 6) {
						beforePage.$vm.updatetitle(beforePage.options.title + "(新增中)");
						this.status = 2;
						//再次扫码调出来赋值控件  这里是表体新增控件
						this.formDate[this.$kdup.getindex(this.formDate)].rules.value = res.data.Table[0]
							.matnumber + "(" + res.data.Table[0].matname + ")";
						this.formDate[this.$kdup.getindex(this.formDate) + 1].rules.value = res.data.Table[0]
							.matmodel;
						this.formDate[this.$kdup.getindex(this.formDate) + 2].rules.value = res.data.Table[0]
							.unitname;
						//这里根据选择依次解锁   
						this.$kdup.unLock(this.formDate, res.data, res.data.smallBars,
							res.data.srcInfos, this)
						//显示辅助属性
						this.formDate = this.$kdup.hideAuxproperty(res.data.Table[0].auxproptykeys,
							this.formDate[this.$kdup.getindex(this.formDate) - 1].property.auxproptykeys,
							this.formDate);
					}
					//仓库、调入仓库
					else if (property.ffieldtype == 7 || property.ffieldtype == 71) {
						//选择仓库打开表格
						if (res.data.Table.length > 2) {
							this.sendCode1(index, property, res.data.Table[0].number)
							return
						}
						//选择仓库锁定/开启库位
						this.$kdup.openlocation(this.formDate, res.data.Table[0], this, property.ffieldtype)
						//这个方法是选择仓库清空下面的控件
						// this.$kdup.stockSetValue(this.formDate, res.data, this, property.ffieldtype)
					}

					var name = this.formDate[index].rules.rowvalue.name;
					var id = this.formDate[index].rules.rowvalue.id;
					//这里是表体选择后赋值
					// if(property.finorout==1 ){

					// }
					this.$emit("input-val", JSON.stringify({
						//如果找不到name就放回number
						val: res.data.Table[0].name == undefined ? res.data.Table[0].number : res
							.data.Table[0].name,
						index: index,
						rowvalue: res.data.Table[0]
					}))
					//盘点方案记得放到赋值后面
					var countscheme = "";
					if (property.ffieldtype == "58") {
						countscheme = property.fkey;
						countscheme = this.$kdup.getJson(this.formDate, "key", countscheme);
						countscheme = countscheme.rules.rowvalue.number;
						if (this.$kdup.isEmpty(countscheme)) {
							uni.showToast({
								title: "请先输入盘点方案",
								icon: "none"
							});
							return;
						}
						this.$kdup.countscheme = countscheme;
					}
					//不需要保存数据到缓存中、扫描位置是表体时，都不需要保存数据到缓存中
					if (property.fisnosavelast == 0 && property.fscanposition != 1 && property.ffieldtype !=
						"59" && property.ffieldtype != "17") {
						//调用统一修改方法保存数据到缓存中
						this.$kdup.updateValue(this, property.ffieldname, res.data.Table[0].id, this.formDate[
							index].rules.rowvalue, this.fid);
					}
					//选择货主类型清空货主
					if (this.formDate[index].property.ffieldtype == 52 && id != res.data.Table[0].id) {
						for (var i = 0; i < this.formDate.length; i++) {
							if (this.formDate[i].property.ffieldtype != 51)
								continue;
							this.formDate[i].rules.value = "";
							this.formDate[i].rules.rowvalue = {
								id: 0,
								name: "",
								number: ""
							};
							this.$kdup.updateValue(this, this.formDate[i].property.ffieldname, "", this
								.formDate[i].rules.rowvalue, this.fid);
						}
					}
					//如果修改前的值和修改后的值一样则不清空
					if (name != res.data.Table[0].name) {
						//找到关联的对象清空方法
						var union = this.$kdup.getUnion(this, this.formDate, this.formDate[index].property
							.fkey, this.fid);
						this.formDate = union;
					}
				})

			},
			//选择批号和修改数量重新分配条码明细
			AfreshFenPei: function(fqty) {
				//调用重新分配数量
				var FMaterialIdObj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key",
					"FMaterialId")
				if (FMaterialIdObj == null) {
					FMaterialIdObj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key",
						"FMaterialID")
				}
				if (FMaterialIdObj == null) {
					FMaterialIdObj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key",
						"FMATERIALID")
				}
				var mid = FMaterialIdObj.rules.rowvalue.materialid;
				var data = {
					materialId: mid,
					fqty: fqty
				}
				this.$myRequest.postRequest("AfreshFenPei", data).then(res => {
					if (!res.data.hasOwnProperty("error")) {
						var srcInfos = res.data.srcInfos;

						var sumqty = 0; //如果不为空并且长度大于0则新增源单
						if (srcInfos != undefined && srcInfos.length > 0) {
							for (var i = 0; i < srcInfos.length; i++) {
								sumqty += parseFloat(srcInfos[i].fqty);
							}
							this.formDate = this.$kdup.getSourceDetail(this.formDate, "", srcInfos !=
								undefined ? srcInfos.length : 0, sumqty, srcInfos);
						}
					}
				});
			},
			//点击获取当前索引方法
			geindex: function(e, property) {
				//点击获取到
				this.index = e;
				this.property = property;
			},
			//时间的change方法
			bindDateChange: function(e) {
				this.date = e.target.value;
				this.$emit("input-val", JSON.stringify({
					val: this.date,
					index: this.index,
					rowvalue: {
						id: this.date,
					}
				}))
				//不等于工序汇报单,并且不等于条码库存查询的条码生产日期0
				if (this.formDate[this.index].property.fscanposition != 1 && this.formDate[this.index].property
					.fcloudbillkey != "top_GXHB" && this.formDate[this.index].rules.name != "生产日期0") {
					this.$kdup.updateValue(this, this.formDate[this.index].property.ffieldname, this.date, this
						.formDate[this.index].rules.rowvalue, this.fid);
				}
			},
			//复选框赠品的change方法
			checkboxChange: function(index) {
				if (this.formDate[index].property.fnullvalue == 1) {
					this.formDate[index].property.fnullvalue = "0";
				} else {
					this.formDate[index].property.fnullvalue = "1";
				}
				this.formDate[index].rules.value = this.formDate[index].property.fnullvalue;
				this.formDate[index].rules.rowvalue.id = this.formDate[index].property.fnullvalue;
			},
			//时间格式化方法
			getDate1: function(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			//input输入框的值传给父组件
			inputVal: function(index) {
				//这里判断类型11数量的时候触发
				if (this.formDate[index].label == "数量" && this.formDate[index].property.ffieldtype == 11) {
					this.AfreshFenPei(parseFloat(this.formDate[index].rules.value));
				}
				this.$emit("input-val", JSON.stringify({
					val: this.formDate[index].rules.value,
					index: index,
					rowvalue: {
						id: this.formDate[index].rules.value,
					},
				}))

			},
			// 选择下拉框
			selectInput: function(index, property, disabled) {
				if (disabled) {
					return;
				}
				var data = {
					key: property.fcombovalue
				}
				this.property = property;
				//之定义下拉款的值
				if(this.formDate[index].label=="扫描状态"){
					var arr=[{id:0,name:"未扫描"},{id:1,name:"已扫描"}];
					//找到数据
					this.selectBox = [];
					this.currentSelectIndex = "";
					this.currentSelectValue = "";
					this.currentSelectIndex = index;
					for (var i = 0; i < arr.length; i++) {
						var selectVal = {
							value: arr[i].name,
							flag: false,
							rowvalue: arr[i]
						}
						if (arr[i] == this.formDate[index].rules.value) { //判断上次选中的那个
							selectVal.flag = true;
						}
						this.selectBox.push(selectVal)
					}
					this.show = true;
					var animation = uni.createAnimation({
						duration: 300,
						timingFunction: 'ease',
					})
					this.animation = animation;
					animation.bottom("0").step()
					this.animationData = this.animation.export()
					this.$emit("select-input-btn", index);
				}else{
					this.$myRequest.postRequest("GetComboxLst", data).then(res => {
						if (res.data.error == "") {
							//找到数据
							this.selectBox = [];
							this.currentSelectIndex = "";
							this.currentSelectValue = "";
							this.currentSelectIndex = index;
							for (var i = 0; i < res.data.Table.length - 1; i++) {
								var selectVal = {
									value: res.data.Table[i].name,
									flag: false,
									rowvalue: res.data.Table[i]
								}
								if (res.data.Table[i] == this.formDate[index].rules.value) { //判断上次选中的那个
									selectVal.flag = true;
								}
								this.selectBox.push(selectVal)
							}
							this.show = true;
							var animation = uni.createAnimation({
								duration: 300,
								timingFunction: 'ease',
							})
							this.animation = animation;
							animation.bottom("0").step()
							this.animationData = this.animation.export()
							this.$emit("select-input-btn", index);
						} else {
							//未找到数据
							uni.showToast({
								title: property.ftitle + res.data.error,
								icon: "none",
								duration: 3000
							});
						}
					});
				}
			},
			// 取消选择框
			cancel: function() {
				var pages = getCurrentPages(); //当前页
				var beforePage = pages[pages.length - 1]; //上个页面
				beforePage.$vm.select();
				var that = this;
				var animation = uni.createAnimation({
					duration: 300,
					timingFunction: 'ease',
				})
				this.animation = animation;
				animation.bottom("-1000upx").step()
				this.animationData = this.animation.export()
				setTimeout(function() {
					that.show = false;
				}, 200)
			},
			// 确定
			sure: function() {
				this.$emit("sure-btn", JSON.stringify({
					currentSelectIndex: this.currentSelectIndex,
					currentSelectValue: this.currentSelectValue
				}))
				//调用统一修改方法
				if (this.property.fscanposition != 1 ) {
					this.$kdup.updateValue(this, this.property.ffieldname, this.currentSelectValue.id, this
						.currentSelectValue, this.fid);
				}
				this.cancel();
			},
			//选择值
			selectItem: function(value, index, rowvalue) {
				this.currentSelectValue = rowvalue;
				for (var i = 0; i < this.selectBox.length; i++) {
					this.$set(this.selectBox[i], "flag", false);
				}
				this.selectBox[index].flag = true;
			},
			//条码详情
			barcode: function(index, property) {
				//每次都从缓存拿出来
				var obj = new Array();
				obj = this.formDate[index].rules.rowvalue.id;
				this.$kdup.formDate1 = this.formDate;
				//把值传到条码详情页面
				uni.navigateTo({
					url: '/pages/detail/detail?smallbars=' + JSON.stringify(obj) + '&head=' + JSON.stringify(
						this.head)
				})
			},
			//源单明细
			source: function(index, property) {
				//每次都从缓存拿出来
				var obj = new Array();
				obj = this.formDate[index].rules.rowvalue.id;
				this.$kdup.formDate1 = this.formDate;
				var qty = this.getQty(this.formDate, "key", "FQty")
				qty = qty.rules.value;
				//把值传到源单详情页面
				uni.navigateTo({
					url: '/pages/source/source?srcInfos=' + JSON.stringify(obj) + "&qty=" + qty + '&head=' +
						JSON.stringify(this.head)
				})
			},
			//工序系列
			// Getgxxl: function(index, property) {
			// 	if(property.ffieldtype == "502"){
			// 	 if(this.$kdup.isEmpty(this.FMaterialId)){
			// 		uni.showToast({
			// 			title: "请先输入生产订单",
			// 			icon: "none"
			// 		}); 
			// 		return;
			// 	 }	
			// 	}
			// 	//每次都从缓存拿出来
			// 	var obj = new Array();
			// 	obj = this.formDate[index].rules.rowvalue.id;
			// 	this.$kdup.formDate1 = this.formDate;
			// 	//把值传到工序系列页面
			// 	uni.navigateTo({
			// 		url: '/pages/gxxllist/gxxllist?gxxllists=' + JSON.stringify(obj) + "&head="+
			// 			JSON.stringify(this.formDate)
			// 	})
			// },
			//找到数量
			getQty: function(formDate, key, qty) {
				for (var i = 0; i < formDate.length; i++) {
					if (formDate[i].property.ffieldtype == 11) {
						return formDate[i];
					}
				}
			},
			// 扫条码
			sendCode: function(index, property) {
				// 允许从相机和相册扫码
				uni.scanCode({
					success: (res) => {
						this.$emit("input-val", JSON.stringify({
							val: res.result,
							index: index,
							rowvalue: {
								id: res.result,
							},
						}))
						//等于表头的情况下并且不是条码才保存起来
						if (property.fscanposition != 1 && property.ffieldtype != 6 && property
							.ffieldtype != 13) {
							//调用统一修改方法
							this.$kdup.updateValue(this, property.ffieldname, res.result, this.formDate[
								index].rules.rowvalue, this.fid);
						}
						this.enter(index, property, res.result);
					}
				});
			},
			//打开新的表格页面
			sendCode1: function(index, property, _number) {
				var orgId = 0,
					stockId = 0,
					barid = 0;
				var sourcetypeId = "";
				var useOrgCtrl = this.$kdup.getKey(this.head.length != 0 ? this.head : this.formDate, property
					.fuseorgkey);
				var filter = this.$kdup.getFilter(this.head.length != 0 ? this.head : this.formDate, property.ffilter);

				//条码
				if (property.ffieldtype == "6") {
					//这里是处理库存查询的条码选择的时候碰到组织是否已经选择
					for (var i = 0; i < this.formDate.length; i++) {
						if (this.formDate[i].property.ffieldtype == "5" && this.formDate[i].rules.value == "") {
							uni.showToast({
								title: "请先输入" + this.formDate[i].property.ftitle,
								icon: "none"
							});
							return;
						}
					}
				} else if (property.fscanposition == 1 || property.ffieldtype == "55") {
					//表体、分录源单
					var barkey = this.$kdup.mainFieleKey.barcode.fkey;
					var barobj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key", barkey)
					barid = barobj.rules.rowvalue.id;
				}
				// if(property.ffieldtype == "59"){
				// this.getmobillno();
				// }
				if (property.ffieldtype == "8" && this.mainFieleKey.sp.fkey == property.fkey) {
					//库位
					var stockKey = this.mainFieleKey.stock.fkey;
					var stockObj = this.$kdup.getJson(this.head, "key", stockKey);
					stockId = stockObj.rules.rowvalue.id;
				} else if (property.ffieldtype == "81" && this.mainFieleKey.spTo.fkey == property.fkey) {
					var stockKey = this.mainFieleKey.stockTo.fkey;
					var stockObj = this.$kdup.getJson(this.head, "key", stockKey);
					stockId = stockObj.rules.rowvalue.id;
				} else if (property.ffieldtype == "13" || property.ffieldtype == "17") {
					//特殊处理生产汇报
					if (property.fcloudbillkey != "top_GXHB") {
						//选择源单单号的时候先获取源单类型
						var sourcetype = this.$kdup.mainFieleKey.srcType.fkey;
						sourcetypeId = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key",
							sourcetype);
						sourcetypeId = sourcetypeId.rules.rowvalue.id
						if (this.$kdup.isEmpty(sourcetypeId)) {
							uni.showToast({
								title: "请先输入源单类型",
								icon: "none"
							});
							return;
						}
					}

				}
				//碰到点击图标的时候fuseorgkey是不是为空，为空直接打开表格，不为空找到匹配的对象
				if (property.hasOwnProperty("fuseorgkey") && !this.$kdup.isEmpty(property.fuseorgkey)) {
					if (this.$kdup.isEmpty(useOrgCtrl.rules.rowvalue.id) || useOrgCtrl.rules.rowvalue.id == "0" ||
						useOrgCtrl.rules.rowvalue.name == undefined) {
						uni.showToast({
							title: "请先输入" + useOrgCtrl.property.ftitle,
							icon: "none"
						});
						return;
					}
				}
				//批号获取物料查询库存批号库存 
				if (property.ffieldtype == "9") {
					var FMaterialIdObj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key",
						"FMaterialId")
					if (FMaterialIdObj == null) {
						FMaterialIdObj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key",
							"FMaterialID")
					}
					if (FMaterialIdObj == null) {
						FMaterialIdObj = this.$kdup.getJson(this.head.length != 0 ? this.head : this.formDate, "key",
							"FMATERIALID")
					}
					this.FMaterialId = FMaterialIdObj.rules.rowvalue.matnumber;
					var stockKey = this.mainFieleKey.stock.fkey;
					var stockObj = this.$kdup.getJson(this.head, "key", stockKey);
					stockId = stockObj.rules.rowvalue.id;
				}
				//匹配对象填好后进入orgId=填好的值
				orgId = useOrgCtrl != null ? useOrgCtrl.rules.rowvalue.id : 0;
				var url = '/pages/table/table?index=' + index + "&fformkeyid=" + property.fformkeyid + "&ffilter=" +
					filter +
					"&orgId=" + orgId + "&fieldType=" + property.ffieldtype + "&stockId=" + stockId + "&auxKey=" +
					property.fauxformkeyid +
					"&sourcetypeId=" + sourcetypeId + "&barid=" + barid + "&number=" + _number + "&materialFnumber=" +
					this.FMaterialId;


				uni.navigateTo({
					url: url
				})
			},

		}
	}
</script>

<style lang="scss">
	Am-FontAwesomeP {}

	.iszp {
		background: #7FFFD4;
	}

	.nozp {
		background-color: #D3D3D3;
	}

	// 弹框
	.select-modal {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		z-index: 300000;

		.select-bg {
			width: 100%;
			height: 100%;
			background: rgba(0, 0, 0, 0.3);
		}

		.select-box {
			position: absolute;
			left: 0;
			bottom: -1000upx;
			width: 100%;
			background: #fff;
			max-height: 50%;
			// height: 0%;
			overflow: auto;

			.select-title {
				display: flex;
				justify-content: space-between;
				height: 100upx;
				background: #f5f5f5;
				line-height: 100upx;
				padding: 0 30upx;
			}

			.select-item {
				font-size: 28upx;
				color: #333;
				border-bottom: 1px solid #eee;
				height: 100upx;
				line-height: 100upx;
				padding: 0 30upx;

				i {
					display: block;
					float: right;
					// border-bottom: 4upx solid #00BFFF;
					// border-right: 4upx solid #00BFFF;
					width: 22upx;
					height: 36upx;
					transform: rotate(45deg);
					margin-top: 24.5upx;
				}
			}
		}

		@keyframes mymove {
			0% {
				max-height: 10%;
			}

			100% {
				max-height: 50%;
			}
		}

		/*Safari 和 Chrome:*/
		@-webkit-keyframes mymove {
			0% {
				max-height: 10%;
			}

			100% {
				max-height: 50%;
			}
		}
	}

	// 下拉icon
	.select-icon {
		// display: block;
		float: right;
		border-bottom: 2upx solid #999;
		border-right: 2upx solid #999;
		width: 16upx;
		height: 16upx;
		transform: rotate(-45deg);
		margin-right: 10upx;
	}

	.color-orange {}

	.color-999 {
		color: #999;
	}

	.font32 {
		font-size: 32upx;
	}

	.plaClass {
		color: #dbdbdb;
	}

	.form-container {
		//偏移最下面按钮高度
		margin-bottom: 100px;

		padding: 0 30upx;

		.form-box {
			width: 100%;
			box-sizing: border-box;
		}

		.colorRed {
			color: red;
		}

		.colorRed1 {
			color: #000000;
		}

		//设置禁用的颜色
		.colorRed2 {
			//color: #cccccc;
		}

		.img-box {
			border-bottom: 1px solid #ededed;
			padding: 30upx 0;

			.update-img-box {
				border: 1px solid #ededed;
				display: flex;

				.update-img {
					width: 140upx;
					height: 140upx;
				}
			}

			.update-img-box2 {
				overflow: hidden;
				display: flex;
			}

			.update-img-box,
			.update-btn-box {
				width: 140upx;
				height: 140upx;
				position: relative;
				margin-top: 20upx;
			}

			.update-img-box .close-img {
				width: 40upx;
				height: 40upx;
				position: absolute;
				right: -12upx;
				top: -16upx;
				background: #fff;
				border-radius: 50%;
			}

			img {
				width: 140upx;
				height: 140upx;
				object-fit: cover;
			}
		}

		.line-right {
			flex: 1;
			height: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			position: relative;

		}

		.send-code-box {
			.send-code {
				font-size: 22upx;
				padding: 0;
				white-space: nowrap;
				// width: 60%;
				//color:#ff5b01;
				height: 90upx;
				line-height: 90upx;
				cursor: pointer;
			}
		}

		//这里设置标题宽度
		.line-left {
			display: flex;
			width: 22%;
			align-items: center;
			height: 100%;
			font-size: 26upx;
			color: #333;
			box-sizing: border-box;
		}

		.img-label {
			width: 100%;
			height: 100%;
			font-size: 26upx;
			color: #333;
			box-sizing: border-box;
		}

		.p-l14 {
			padding-left: 14upx;
		}

		.textarea-box {
			// display: flex;
			border-bottom: 1px solid #C0C0C0;
			padding-top: 20upx;

			// align-items: center;
			textarea {
				height: 150upx;
				font-size: 26upx;
				color: #333;
				width: 100%;
				margin-top: 20upx;
			}
		}

		.line {
			margin-top: 30upx;
			height: 100upx;
			width: 100%;
			margin: 0 auto;
			//border-bottom: 1px dashed #00BFFF;
			display: flex;
			overflow: hidden;

			.input {
				padding-right: 20upx;
				height: 100%;
				width: 100%;
				text-align: left;
				font-size: 26upx;
				color: #333;
				border: none;
				overflow: hidden;
				text-overflow: ellipsis;
				outline: none;
			}
		}
	}
</style>
